/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.permission.store;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.B050;
import queenb.web.permission.inteface.B050Inf;
import queenb.web.util.PackageContants;

/**
 *
 * @author VANANH
 */
public class B050Store extends B050 implements B050Inf{

    @Override
    public List<B050> getListB050All(int pnFH000, int pnFH200, String pvBV051, String pvLOGIN) {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_B050, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.CHAR, pvBV051),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        try {
            return super.find(dataStatement, B050.class);
        } catch (SQLException ex) {
            Logger.getLogger(B050Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (InstantiationException ex) {
            Logger.getLogger(B050Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        } catch (IllegalAccessException ex) {
            Logger.getLogger(B050Store.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    @Override
    public int delete(int pnPB050, String pvLOGIN) {
         try {
            DataStatement dataStatement = new DataStatement(PackageContants.DELETE_B050, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPB050),
                        new Param(OracleTypes.CHAR, pvLOGIN)
                    });
            return super.update(dataStatement, B050.class);
        } catch (SQLException ex) {
            Logger.getLogger(B050Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }
    }

    @Override
    public int update(int pnPB050, int pnFH000, int pnFH200, int pnFS200, int pnFH075, int pnFH150, String pvBV051, String pvBV052, Date pdBD053, String pvBV054,
    int pnBN055, int pnBN056, int pnBN057, int pnBN058, int pnBN059, String pvBV060, int pnBN061, int pnBN062, String pvLOGIN) {
       DataStatement dataStetament = new DataStatement(PackageContants.UPDATE_B050, OracleTypes.INTEGER, new Param[]{
                    new Param(OracleTypes.INTEGER, pnPB050),
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFS200),
                    new Param(OracleTypes.INTEGER, pnFH075),
                    new Param(OracleTypes.INTEGER, pnFH150),
                    new Param(OracleTypes.CHAR, pvBV051),
                    new Param(OracleTypes.CHAR, pvBV052),
                    new Param(OracleTypes.DATE, pdBD053),
                    new Param(OracleTypes.CHAR, pvBV054),
                    new Param(OracleTypes.INTEGER, pnBN055),
                    new Param(OracleTypes.INTEGER, pnBN056),
                    new Param(OracleTypes.INTEGER, pnBN057),
                    new Param(OracleTypes.INTEGER, pnBN058),
                    new Param(OracleTypes.INTEGER, pnBN059),
                    new Param(OracleTypes.CHAR, pvBV060),
                    new Param(OracleTypes.INTEGER, pnBN061),
                    new Param(OracleTypes.INTEGER, pnBN062),
                    new Param(OracleTypes.CHAR, pvLOGIN),});
        try {
            return super.update(dataStetament, B050.class);
        } catch (SQLException ex) {
            Logger.getLogger(B050Store.class.getName()).log(Level.SEVERE, null, ex);
            return -1;
        }
    }
    
}
